<!DOCTYPE html>
<html lang="en">
<head>
    <!-- 通过meta标签,设定读取网络来源图片 -->
    <meta name="referrer" content="never">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../tools/bootstrap-3.3.7-dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="../tools/jquery-pagination/pagination.css">
    <link rel="stylesheet" href="../css/list.css">
    <style>
    .breadcrumb {
      padding-left: 6px;
      padding-right: 6px;
    }

    .box {
      width: 800px;
      margin: 100px auto;
    }

    .m-style .next,
    .m-style .prev {
      border: 2px solid red;
    }

    /* .m-style .active {
      background: orange;
      border: 1px solid orange;

    } */

    .m-style .jump-ipt {
      width: 100px;
    }
    </style>
</head>
<body>
    <div class="top">
        <div class="center">
            <img src="../images/01.jpg" alt="">
            <ul>
                <li><a href="./reg.html">注册</a></li>
                <li><a href="JavaScript:;" name="login" role="button">登录</a></li>
                <li><a href="JavaScript:;" name="logout" >退出登录</a></li>
                <li><a name="cart">购物车</a></li>
                <li>关于我们</li>
            </ul>
        </div>
    </div>
    <div class="nav-top">
        <div class="center">
            <ul>
                <li><a href="./list.html?cat_one_id=食品酒水" role="button">食品酒水</a></li>
                <li><a href="./list.html?cat_one_id=童装玩具" role="button">童装玩具</a></li>
                <li><a href="./list.html?cat_one_id=家装建材" role="button">家装建材</a></li>
                <li><a href="./list.html?cat_one_id=奶粉尿裤" role="button">奶粉尿裤</a></li>
                <li><a href="./list.html?cat_one_id=大家电" role="button">大家电</a></li>
                <li><a href="./list.html?cat_one_id=海外购" role="button">海外购</a></li>
                <li><a href="./list.html?cat_one_id=其他" role="button">其他产品</a></li>
            </ul>
        </div>
    </div>

    <div class="box m-style" style="margin:30px auto"></div>

    <div class="container">
        <ul></ul>
    </div>


    <script src="../js/jquery.min.js"></script>
    <script src="../js/cookie.js"></script>
    <script src="../tools/jquery-pagination/jquery.pagination.js"></script>
    <script src="../js/tools.js"></script>
    <script src="../js/list.js"></script>
    <script>
      $('[name = "login" ]').click(function(){
            window.location.href = `./login.html?url=${window.location.href}`;
        })

        $('[name="logout"]').click(function(){
            const cookieObj = myGetCookie();

            if(cookieObj.login === '1'){
                mySetCookie('login', 0 , -1 , '/');
                window.alert('您已经退出登录了');
            }else{
                window.alert('您还没有登录,请您先登录');
            }
        });


        $('[name="cart"]').click(() => {
          let obj = myGetCookie();
          if (obj.login === undefined) {
            window.alert('请先登录才能进入购物车');
            window.location.href = `./login.html?url=${window.location.href}`;
          } else {
            window.location.href = './cart.html';
          }
        })
    </script>
    
</body>
</html>